package com.million.msmservice.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Author: studyboy
 * @Date: 2022/4/3  12:26
 */

@Component
public class TengXunSmsProperties implements InitializingBean {

    @Value("${tengxun.sms.secretId}")
    private String secretId;

    @Value("${tengxun.sms.secretKey}")
    private String secretKey;

    @Value("${tengxun.sms.appid}")
    private String appid;

    @Value("${tengxun.sms.sign}")
    private String sign;

    @Value("${tengxun.sms.templateID}")
    private String templateID;

    public static String SECRET_ID;

    public static String SECRET_KEY;

    public static String APP_ID;

    public static String SIGN;

    public static String TEMPLATE_ID;
    //当私有成员被赋值后，此方法自动被调用，从而初始化常量

    @Override
    public void afterPropertiesSet () throws Exception {
        SECRET_ID = secretId;
        SECRET_KEY = secretKey;
        APP_ID = appid;
        SIGN = sign;
        TEMPLATE_ID = templateID;
    }
}
